package com.victor.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import com.victor.entity.Option;
import com.victor.entity.Question;

@Mapper
public interface QuestionnaireDao {

	/**
	 * 获取问卷调查列表
	 * 
	 * @return
	 */
	List<Question> getall();

	/**
	 * 向数据库添加问题
	 * 
	 * @param question
	 * @return
	 */
	int addQuestion(Question question);

	/**
	 * 向数据库添加选项
	 * 
	 * @param options
	 * @return
	 */
	int addOptions(List<Option> options);

	/**
	 * 修改问题
	 * 
	 * @param question
	 * @return
	 */
	int updateQuestion(Question question);

	/**
	 * 通过问题id删除所有选项
	 * 
	 * @param id
	 * @return
	 */
	@Delete({ "delete from q_option where questionid=#{id}" })
	int deleteOption(Integer id);

	/**
	 * 删除提问
	 * 
	 * @param qid
	 * @return
	 */
	@Delete("delete from q_question where id=#{qid}")
	int deleteQuestion(int qid);

}
